package com.example.intelligentattendancesystem.pojo;

import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.Objects;

/**
 * 记录缺勤信息的实体类
 * @author
 * @version 1.0
 * @className Absence
 * @since 1.0
 */
@Component
public class Absence {
//       id                 int auto_increment primary key,
//    user_id            int,
//    absence_start_time DateTime,
//    absence_end_time   DateTime,
    private Integer id;
    private int userId;
    private String absenceStartTime;
    private String absenceEndTime;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Absence absence = (Absence) o;
        return userId == absence.userId && Objects.equals(id, absence.id) && Objects.equals(absenceStartTime, absence.absenceStartTime) && Objects.equals(absenceEndTime, absence.absenceEndTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id, userId, absenceStartTime, absenceEndTime);
    }

    @Override
    public String toString() {
        return "Absence{" +
                "id=" + id +
                ", userId=" + userId +
                ", absenceStartTime=" + absenceStartTime +
                ", absenceEndTime=" + absenceEndTime +
                '}';
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public int getUserId() {
        return userId;
    }

    public void setUserId(int userId) {
        this.userId = userId;
    }

    public String getAbsenceStartTime() {
        return absenceStartTime;
    }

    public void setAbsenceStartTime(String absenceStartTime) {
        this.absenceStartTime = absenceStartTime;
    }

    public String getAbsenceEndTime() {
        return absenceEndTime;
    }

    public void setAbsenceEndTime(String absenceEndTime) {
        this.absenceEndTime = absenceEndTime;
    }

    public Absence(Integer id, int userId, String absenceStartTime, String absenceEndTime) {
        this.id = id;
        this.userId = userId;
        this.absenceStartTime = absenceStartTime;
        this.absenceEndTime = absenceEndTime;
    }

    public Absence() {
    }
}
